﻿@model IEnumerable<Blog.IdentityServer4.Model.ApplicationRole>

@{
    ViewData["Title"] = "Roles";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>@ViewData["Title"]</h2>
<hr />
<div class="row">
    <div class="col-md-12">
        <div>
            <div class="pull-left">
                <a asp-action="RoleRegister" asp-route-returnUrl="/account/Roles" class="btn btn-primary">
                    <span title="Register New" class="glyphicon glyphicon-plus-sign"></span> Register New
                </a>
            </div>
        </div>
    </div>
</div>
<br />
<div class="panel panel-default">
    <table class="table table-striped">
        <thead>
            <tr>
                <th>
                    Name
                </th>
                <th>Operate</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        @Html.DisplayFor(modelItem => item.Name)
                    </td>

                    <td>
                        <a asp-action="Edit" asp-route-id="@item.Id" asp-route-returnUrl="/account/Roles" title="Edit" class="btn btn-warning">
                            <span class="glyphicon glyphicon-pencil"></span>
                        </a>


                        <button type="button" class="btn btn-danger viewbtn" title="History" data-id="@item.Id" data-toggle="modal" data-target="#DeleteRole">
                            <span class="glyphicon glyphicon-trash"></span>
                        </button>

                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>

<div class="modal fade" id="DeleteRole" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">警告</h4>
            </div>
            <div class="modal-body">确定要删除当前这条记录么？</div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary deletebutton">删除</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<script src="~/js/role.js"></script>
